<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
</head>
<body>

<h3 th:if="!${info}" th:text="${msg}"></h3>
<h3 th:text="${info}"></h3>

<hr>
<div th:if="${info}">
    <a th:href="@{/toAdd}">add</a><br>
    <table border>
        <tr>
            <th>编号</th>
            <th>姓名</th>
            <th>密码</th>
            <th>权限</th>
            <th>管理</th>
        </tr>
        <tbody>
        <tr th:each="user:${userList}">
            <td th:text="${user.id}"></td>
            <td th:text="${user.username}"></td>
            <td th:text="${user.password}"></td>
            <td th:text="${user.perms}"></td>
            <td>
                <a th:href="@{/toUpdate(id=${user.id})}">编辑</a> &nbsp;&nbsp;
                <a th:href="@{/user/delete/(id=${user.id})}">删除</a>
            </td>
        </tr>
        </tbody>
    </table>
</div>

<hr>
<a th:if="!${info}" th:href="@{/toLogin}">登录</a>
<a th:if="${info}" th:href="@{/logout}">注销</a>


</body>
</html>